package app.modules.cloudpivot.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.authine.cloudpivot.engine.api.model.runtime.BizObjectModel;

/**
 * 业务规则发起流程切面
 *
 * @author LiuGangQiang Create in 2025/11/05
 */
//@Aspect
//@Component
public class WorkflowInstanceFacadeImplAspect {
    private static final Logger LOG = LoggerFactory.getLogger(WorkflowInstanceFacadeImplAspect.class);

    @Around("execution(* com.authine.cloudpivot.engine.api.facade.dubbo.WorkflowInstanceFacadeImpl.startWorkflowInstanceInTransaction(..))")
    public Object exectime(ProceedingJoinPoint point) throws Throwable {
        Object[] args = point.getArgs();
        if (args != null) {
            for (int i = 0; i < args.length; i++) {
                if (args[i] instanceof BizObjectModel) {
                    BizObjectModel model = (BizObjectModel) args[i];
                    LOG.info("===>> 获取到的值是：{}", model.getData());
                }
            }
        }
        Object proceed = point.proceed(args);
        return proceed;
    }
}
